
<%@include file="header.jsp"%>

<%@page import="br.unirio.ticketnator.model.Sistema"%>
<%@page import="br.unirio.ticketnator.dao.SistemaDAO"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="br.unirio.ticketnator.dao.DAOFactory"%>

<div class="container">
    <c:if test="${#usuario.codPermissao==1}">
        <h2 class="form-signin-heading">Sistemas</h2>
        <a href="cadastra_sistema.jsp">Cadastrar Sistema</a>
          <table class="table table-bordered">
        <tr>
                <td>Sistema</td>
        </tr>
            <% List<Sistema> lista = DAOFactory.getSistemaDAO().lista(0, 25);
             for (int i =0; i < lista.size(); i++){
            %>
            <tr>
                <td><%out.print(lista.get(i).getNomeSistema());%></td>
                <td><a href="edit_sistema.jsp?id=<%out.print(lista.get(i).getIdSistema());%>" class="navbar-link">Editar</a></td>
            </tr>
        <%} %>
        </table>
        <s:url id="nextURL" action="list"><s:param name="page"><s:property value="nextPage"/></s:param></s:url>
        <s:url id="prevURL" action="list"><s:param name="page"><s:property value="previousPage"/></s:param></s:url>
    </c:if>
        <s:else>
            <c:redirect url="index.jsp"/>
        </s:else>
</div> <!-- /container -->
<%@include file="footer.jsp"%>            